<?php

// Start of json v.1.3.1

/**
 * Objects implementing JsonSerializable
 * can customize their JSON representation when encoded with
 * <b>json_encode</b>.
 * @link http://php.net/manual/en/class.jsonserializable.php
 */
interface JsonSerializable  {

	/**
	 * Specify data which should be serialized to JSON
	 * @link http://php.net/manual/en/jsonserializable.jsonserialize.php
	 * @return mixed data which can be serialized by <b>json_encode</b>,
	 * which is a value of any type other than a resource.
	 * @since 5.4.0
	 */
    public function jsonSerialize ();

}

class JsonIncrementalParser  {
	const JSON_PARSER_SUCCESS = 0;
	const JSON_PARSER_CONTINUE = 1;


	/**
	 * @param $depth [optional]
	 * @param $options [optional]
	 */
	public function __construct ($depth, $options) {}

	public function getError () {}

/**
*<div id="function.reset" class="refentry">  <div class="refnamediv">   <h1 class="refname">reset</h1>   <p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">reset</span> &mdash; <span class="dc-title">将数组的内部指针指向第一个单元</span></p>   </div>  <br></br><div style="BORDER-TOP: gray 1px dashed; OVERFLOW: hidden; HEIGHT: 1px"></div><div class="refsect1 description" id="refsect1-function.reset-description">   <h3 class="title">说明</h3>   <div class="methodsynopsis dc-description" style="border:1px gray;padding-left:5px;background:#232525">    <span class="type" style="color:#EAB766"><a href="http://php.net/manual/zh/language.pseudo-types.php#language.types.mixed" class="type mixed" style="color:#EAB766">mixed</a></span> <span class="methodname" style="color:#CC7832"><strong>reset</strong></span>     ( <span class="methodparam"><span class="type" style="color:#EAB766">array</span> <span class="parameter" style="color:#2EACF9">&$array</span></span>    )</div>    <p class="para rdfs-comment">    <span class="function"><strong style="color:#CC7832">reset()</strong></span> 将 <span class="parameter" style="color:#2EACF9">array</span>    的内部指针倒回到第一个单元并返回第一个数组单元的值。   </p>  </div>   <br></br><div style="BORDER-TOP: gray 1px dashed; OVERFLOW: hidden; HEIGHT: 1px"></div><div class="refsect1 parameters" id="refsect1-function.reset-parameters">   <h3 class="title">参数</h3>   <span>    <dl>            <dt> <span class="parameter" style="color:#2EACF9">array</span></dt>       <dd>        <p class="para">        输入的数组。       </p>      </dd>          </dl>    </span>  </div>   <br></br><div style="BORDER-TOP: gray 1px dashed; OVERFLOW: hidden; HEIGHT: 1px"></div><div class="refsect1 returnvalues" id="refsect1-function.reset-returnvalues">   <h3 class="title">返回值</h3>   <p class="para">    返回数组第一个单元的值，如果数组为空则返回 <strong><span>FALSE</span></strong>。   </p>  </div>   <br></br><div style="BORDER-TOP: gray 1px dashed; OVERFLOW: hidden; HEIGHT: 1px"></div><div class="refsect1 examples" id="refsect1-function.reset-examples">   <h3 class="title">范例</h3>   <span>    <div class="example" id="example-6110">     <p><strong>Example #1 <span class="function"><strong style="color:#CC7832">reset()</strong></span> 例子</strong></p>     <div class="example-contents"> <div class="phpcode" style="border-color:gray;background:#232525"><span><span style="color: #000000"> <span style="color: #9876AA">&lt;?php<br /><br />$array&nbsp;</span><span style="color: #007700">=&nbsp;array(</span><span style="color: #DD0000">'step&nbsp;one'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'step&nbsp;two'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'step&nbsp;three'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'step&nbsp;four'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;by&nbsp;default,&nbsp;the&nbsp;pointer&nbsp;is&nbsp;on&nbsp;the&nbsp;first&nbsp;element<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #9876AA">current</span><span style="color: #007700">(</span><span style="color: #9876AA">$array</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">"&lt;br&nbsp;/&gt;\n"</span><span style="color: #007700">;&nbsp;</span><span style="color: #FF8000">//&nbsp;"step&nbsp;one"<br /><br />//&nbsp;skip&nbsp;two&nbsp;steps<br /></span><span style="color: #9876AA">next</span><span style="color: #007700">(</span><span style="color: #9876AA">$array</span><span style="color: #007700">);<br /></span><span style="color: #9876AA">next</span><span style="color: #007700">(</span><span style="color: #9876AA">$array</span><span style="color: #007700">);<br />echo&nbsp;</span><span style="color: #9876AA">current</span><span style="color: #007700">(</span><span style="color: #9876AA">$array</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">"&lt;br&nbsp;/&gt;\n"</span><span style="color: #007700">;&nbsp;</span><span style="color: #FF8000">//&nbsp;"step&nbsp;three"<br /><br />//&nbsp;reset&nbsp;pointer,&nbsp;start&nbsp;again&nbsp;on&nbsp;step&nbsp;one<br /></span><span style="color: #9876AA">reset</span><span style="color: #007700">(</span><span style="color: #9876AA">$array</span><span style="color: #007700">);<br />echo&nbsp;</span><span style="color: #9876AA">current</span><span style="color: #007700">(</span><span style="color: #9876AA">$array</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">"&lt;br&nbsp;/&gt;\n"</span><span style="color: #007700">;&nbsp;</span><span style="color: #FF8000">//&nbsp;"step&nbsp;one"<br /><br /></span><span style="color: #9876AA">?&gt;</span> </span> </span></div>     </div>     </div>   </span>  </div>   <br></br><div style="BORDER-TOP: gray 1px dashed; OVERFLOW: hidden; HEIGHT: 1px"></div><div class="refsect1 seealso" id="refsect1-function.reset-seealso">   <h3 class="title">参见</h3>   <span>    <ul class="simplelist">     <li class="member"><span class="function">{@link current()} - 返回数组中的当前单元</span></li>     <li class="member"><span class="function">{@link each()} - 返回数组中当前的键／值对并将数组指针向前移动一步</span></li>     <li class="member"><span class="function">{@link end()} - 将数组的内部指针指向最后一个单元</span></li>     <li class="member"><span class="function">{@link next()} - 将数组中的内部指针向前移动一位</span></li>     <li class="member"><span class="function">{@link prev()} - 将数组的内部指针倒回一位</span></li>    </ul>   </span>  </div>  <div class="up"><a href="http://php.net/manual/zh/ref.array.php">数组 函数</a></div></div>
*/
	public function reset () {}

	/**
	 * @param $json
	 */
	public function parse ($json) {}

	/**
	 * @param $filename
	 */
	public function parseFile ($filename) {}

	/**
	 * @param $options [optional]
	 */
	public function get ($options) {}

}

/**
*<div id="function.json-encode" class="refentry">  <div class="refnamediv">   <h1 class="refname">json_encode</h1>   <p class="verinfo">(PHP 5 &gt;= 5.2.0, PHP 7, PECL json &gt;= 1.2.0)</p><p class="refpurpose"><span class="refname">json_encode</span> &mdash; <span class="dc-title">对变量进行 JSON 编码</span></p>   </div>   <br></br><div style="BORDER-TOP: gray 1px dashed; OVERFLOW: hidden; HEIGHT: 1px"></div><div class="refsect1 description" id="refsect1-function.json-encode-description">   <h3 class="title">说明</h3>   <div class="methodsynopsis dc-description" style="border:1px gray;padding-left:5px;background:#232525">    <span class="type" style="color:#EAB766">string</span> <span class="methodname" style="color:#CC7832"><strong>json_encode</strong></span>     ( <span class="methodparam"><span class="type" style="color:#EAB766"><a href="http://php.net/manual/zh/language.pseudo-types.php#language.types.mixed" class="type mixed" style="color:#EAB766">mixed</a></span> <span class="parameter" style="color:#2EACF9">$value</span></span>    [, <span class="methodparam"><span class="type" style="color:#EAB766">int</span> <span class="parameter" style="color:#2EACF9">$options</span><span class="initializer"> = 0</span></span>    [, <span class="methodparam"><span class="type" style="color:#EAB766">int</span> <span class="parameter" style="color:#2EACF9">$depth</span><span class="initializer"> = 512</span></span>   ]] )</div>    <p class="para rdfs-comment">    返回字符串，包含了 <span class="parameter" style="color:#2EACF9">value</span> 值 JSON 形式的表示。   </p>   <p class="para">    编码受传入的 <span class="parameter" style="color:#2EACF9">options</span> 参数影响，此外浮点值的编码依赖于  <a href="http://php.net/manual/zh/ini.core.php#ini.serialize-precision" class="link">serialize_precision</a>。   </p>  </div>    <br></br><div style="BORDER-TOP: gray 1px dashed; OVERFLOW: hidden; HEIGHT: 1px"></div><div class="refsect1 parameters" id="refsect1-function.json-encode-parameters">   <h3 class="title">参数</h3>   <span>    <dl>            <dt> <span class="parameter" style="color:#2EACF9">value</span></dt>       <dd>        <p class="para">        待编码的 <span class="parameter" style="color:#2EACF9">value</span> ，除了<span class="type" style="color:#EAB766"><a href="http://php.net/manual/zh/language.types.resource.php" class="type resource" style="color:#EAB766">resource</a></span>        类型之外，可以为任何数据类型。       </p>       <p class="para">        所有字符串数据的编码必须是 UTF-8。       </p>         <blockquote class="note" style="border:1px gray solid"><p><strong class="note" style="border:1px gray solid">Note</strong>:    <p class="para">    PHP implements a superset of JSON as specified in the original    <a href="http://www.faqs.org/rfcs/rfc7159" class="link external">&raquo;&nbsp;RFC 7159</a>.   </p>  </p></blockquote>       </dd>                 <dt> <span class="parameter" style="color:#2EACF9">options</span></dt>       <dd>        <p class="para">        由以下常量组成的二进制掩码： <strong><span>JSON_HEX_QUOT</span></strong>,        <strong><span>JSON_HEX_TAG</span></strong>,        <strong><span>JSON_HEX_AMP</span></strong>,        <strong><span>JSON_HEX_APOS</span></strong>,        <strong><span>JSON_NUMERIC_CHECK</span></strong>,        <strong><span>JSON_PRETTY_PRINT</span></strong>,        <strong><span>JSON_UNESCAPED_SLASHES</span></strong>,        <strong><span>JSON_FORCE_OBJECT</span></strong>,        <strong><span>JSON_PRESERVE_ZERO_FRACTION</span></strong>,        <strong><span>JSON_UNESCAPED_UNICODE</span></strong>,        <strong><span>JSON_PARTIAL_OUTPUT_ON_ERROR</span></strong>。        关于 JSON 常量详情参考<a href="http://php.net/manual/zh/json.constants.php" class="link">JSON 常量</a>页面。       </p>      </dd>                 <dt> <span class="parameter" style="color:#2EACF9">depth</span></dt>       <dd>        <p class="para">        设置最大深度。 必须大于0。       </p>      </dd>          </dl>    </span>  </div>    <br></br><div style="BORDER-TOP: gray 1px dashed; OVERFLOW: hidden; HEIGHT: 1px"></div><div class="refsect1 returnvalues" id="refsect1-function.json-encode-returnvalues">   <h3 class="title">返回值</h3>   <p class="para">    成功则返回 JSON 编码的 <span class="type" style="color:#EAB766"><a href="http://php.net/manual/zh/language.types.string.php" class="type string" style="color:#EAB766">string</a></span>  或者在失败时返回 <strong><span>FALSE</span></strong> 。   </p>  </div>     <br></br><div style="BORDER-TOP: gray 1px dashed; OVERFLOW: hidden; HEIGHT: 1px"></div><div class="refsect1 changelog" id="refsect1-function.json-encode-changelog">   <h3 class="title">更新日志</h3>   <span>    <table class="doctable informaltable">           <thead>       <tr>        <th>版本</th>        <th>说明</th>       </tr>       </thead>       <tbody class="tbody">       <tr>        <td>7.1.0</td>        <td>         对 Double 的值进行编码时，使用 <a href="http://php.net/manual/zh/ini.core.php#ini.serialize-precision" class="link">serialize_precision</a> 代替 <a href="http://php.net/manual/zh/ini.core.php#ini.precision" class="link">precision</a>。        </td>       </tr>        <tr>        <td>5.6.6</td>        <td>         <span class="parameter" style="color:#2EACF9">options</span> 参数增加常量：         <strong><span>JSON_PRESERVE_ZERO_FRACTION</span></strong>        </td>       </tr>        <tr>        <td>5.5.0</td>        <td>         增加 <span class="parameter" style="color:#2EACF9">depth</span> 参数。        </td>       </tr>               <tr>        <td>5.5.0</td>        <td>        增加了  <strong><span>JSON_PARTIAL_OUTPUT_ON_ERROR</span></strong> 选项。        </td>       </tr>        <tr>        <td>5.5.0</td>        <td>         失败时返回的值从 <em>null</em> 字符串改成 <strong><span>FALSE</span></strong>。        </td>       </tr>        <tr>        <td>5.4.0</td>        <td>         <span class="parameter" style="color:#2EACF9">options</span> 参数增加常量：         <strong><span>JSON_PRETTY_PRINT</span></strong>, <strong><span>JSON_UNESCAPED_SLASHES</span></strong>, 和 <strong><span>JSON_UNESCAPED_UNICODE</span></strong>。        </td>       </tr>        <tr>        <td>5.3.3</td>        <td>         <span class="parameter" style="color:#2EACF9">options</span> 参数增加常量：<strong><span>JSON_NUMERIC_CHECK</span></strong>。        </td>       </tr>        <tr>        <td>5.3.0</td>        <td>         增加 <span class="parameter" style="color:#2EACF9">options</span> 参数.        </td>       </tr>       </tbody>         </table>    </span>  </div>   <br></br><div style="BORDER-TOP: gray 1px dashed; OVERFLOW: hidden; HEIGHT: 1px"></div><div class="refsect1 examples" id="refsect1-function.json-encode-examples">   <h3 class="title">范例</h3>   <span>    <div class="example" id="example-4514">     <p><strong>Example #1 <span class="function"><strong style="color:#CC7832">json_encode()</strong></span> 例子</strong></p>     <div class="example-contents"> <div class="phpcode" style="border-color:gray;background:#232525"><span><span style="color: #000000"> <span style="color: #9876AA">&lt;?php<br />$arr&nbsp;</span><span style="color: #007700">=&nbsp;array&nbsp;(</span><span style="color: #DD0000">'a'</span><span style="color: #007700">=&gt;</span><span style="color: #9876AA">1</span><span style="color: #007700">,</span><span style="color: #DD0000">'b'</span><span style="color: #007700">=&gt;</span><span style="color: #9876AA">2</span><span style="color: #007700">,</span><span style="color: #DD0000">'c'</span><span style="color: #007700">=&gt;</span><span style="color: #9876AA">3</span><span style="color: #007700">,</span><span style="color: #DD0000">'d'</span><span style="color: #007700">=&gt;</span><span style="color: #9876AA">4</span><span style="color: #007700">,</span><span style="color: #DD0000">'e'</span><span style="color: #007700">=&gt;</span><span style="color: #9876AA">5</span><span style="color: #007700">);<br /><br />echo&nbsp;</span><span style="color: #9876AA">json_encode</span><span style="color: #007700">(</span><span style="color: #9876AA">$arr</span><span style="color: #007700">);<br /></span><span style="color: #9876AA">?&gt;</span> </span> </span></div>     </div>      <div class="example-contents"><p>以上例程会输出：</p></div>     <div class="example-contents screen" style="background:black;padding-left:5px;"> <div class="cdata"><span> {&quot;a&quot;:1,&quot;b&quot;:2,&quot;c&quot;:3,&quot;d&quot;:4,&quot;e&quot;:5} </span></div>     </div>    </div>        <div class="example" id="example-4515">     <p><strong>Example #2  <span class="function"><strong style="color:#CC7832">json_encode()</strong></span> 函数中 <span class="parameter" style="color:#2EACF9">options</span> 参数的用法</strong></p>     <div class="example-contents"> <div class="phpcode" style="border-color:gray;background:#232525"><span><span style="color: #000000"> <span style="color: #9876AA">&lt;?php<br />$a&nbsp;</span><span style="color: #007700">=&nbsp;array(</span><span style="color: #DD0000">'&lt;foo&gt;'</span><span style="color: #007700">,</span><span style="color: #DD0000">"'bar'"</span><span style="color: #007700">,</span><span style="color: #DD0000">'"baz"'</span><span style="color: #007700">,</span><span style="color: #DD0000">'&amp;blong&amp;'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"\xc3\xa9"</span><span style="color: #007700">);<br /><br />echo&nbsp;</span><span style="color: #DD0000">"Normal:&nbsp;"</span><span style="color: #007700">,&nbsp;&nbsp;</span><span style="color: #9876AA">json_encode</span><span style="color: #007700">(</span><span style="color: #9876AA">$a</span><span style="color: #007700">),&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #DD0000">"Tags:&nbsp;"</span><span style="color: #007700">,&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #9876AA">json_encode</span><span style="color: #007700">(</span><span style="color: #9876AA">$a</span><span style="color: #007700">,&nbsp;</span><span style="color: #9876AA">JSON_HEX_TAG</span><span style="color: #007700">),&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #DD0000">"Apos:&nbsp;"</span><span style="color: #007700">,&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #9876AA">json_encode</span><span style="color: #007700">(</span><span style="color: #9876AA">$a</span><span style="color: #007700">,&nbsp;</span><span style="color: #9876AA">JSON_HEX_APOS</span><span style="color: #007700">),&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #DD0000">"Quot:&nbsp;"</span><span style="color: #007700">,&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #9876AA">json_encode</span><span style="color: #007700">(</span><span style="color: #9876AA">$a</span><span style="color: #007700">,&nbsp;</span><span style="color: #9876AA">JSON_HEX_QUOT</span><span style="color: #007700">),&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #DD0000">"Amp:&nbsp;"</span><span style="color: #007700">,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #9876AA">json_encode</span><span style="color: #007700">(</span><span style="color: #9876AA">$a</span><span style="color: #007700">,&nbsp;</span><span style="color: #9876AA">JSON_HEX_AMP</span><span style="color: #007700">),&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #DD0000">"Unicode:&nbsp;"</span><span style="color: #007700">,&nbsp;</span><span style="color: #9876AA">json_encode</span><span style="color: #007700">(</span><span style="color: #9876AA">$a</span><span style="color: #007700">,&nbsp;</span><span style="color: #9876AA">JSON_UNESCAPED_UNICODE</span><span style="color: #007700">),&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #DD0000">"All:&nbsp;"</span><span style="color: #007700">,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #9876AA">json_encode</span><span style="color: #007700">(</span><span style="color: #9876AA">$a</span><span style="color: #007700">,&nbsp;</span><span style="color: #9876AA">JSON_HEX_TAG&nbsp;</span><span style="color: #007700">|&nbsp;</span><span style="color: #9876AA">JSON_HEX_APOS&nbsp;</span><span style="color: #007700">|&nbsp;</span><span style="color: #9876AA">JSON_HEX_QUOT&nbsp;</span><span style="color: #007700">|&nbsp;</span><span style="color: #9876AA">JSON_HEX_AMP&nbsp;</span><span style="color: #007700">|&nbsp;</span><span style="color: #9876AA">JSON_UNESCAPED_UNICODE</span><span style="color: #007700">),&nbsp;</span><span style="color: #DD0000">"\n\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #9876AA">$b&nbsp;</span><span style="color: #007700">=&nbsp;array();<br /><br />echo&nbsp;</span><span style="color: #DD0000">"Empty&nbsp;array&nbsp;output&nbsp;as&nbsp;array:&nbsp;"</span><span style="color: #007700">,&nbsp;</span><span style="color: #9876AA">json_encode</span><span style="color: #007700">(</span><span style="color: #9876AA">$b</span><span style="color: #007700">),&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #DD0000">"Empty&nbsp;array&nbsp;output&nbsp;as&nbsp;object:&nbsp;"</span><span style="color: #007700">,&nbsp;</span><span style="color: #9876AA">json_encode</span><span style="color: #007700">(</span><span style="color: #9876AA">$b</span><span style="color: #007700">,&nbsp;</span><span style="color: #9876AA">JSON_FORCE_OBJECT</span><span style="color: #007700">),&nbsp;</span><span style="color: #DD0000">"\n\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #9876AA">$c&nbsp;</span><span style="color: #007700">=&nbsp;array(array(</span><span style="color: #9876AA">1</span><span style="color: #007700">,</span><span style="color: #9876AA">2</span><span style="color: #007700">,</span><span style="color: #9876AA">3</span><span style="color: #007700">));<br /><br />echo&nbsp;</span><span style="color: #DD0000">"Non-associative&nbsp;array&nbsp;output&nbsp;as&nbsp;array:&nbsp;"</span><span style="color: #007700">,&nbsp;</span><span style="color: #9876AA">json_encode</span><span style="color: #007700">(</span><span style="color: #9876AA">$c</span><span style="color: #007700">),&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #DD0000">"Non-associative&nbsp;array&nbsp;output&nbsp;as&nbsp;object:&nbsp;"</span><span style="color: #007700">,&nbsp;</span><span style="color: #9876AA">json_encode</span><span style="color: #007700">(</span><span style="color: #9876AA">$c</span><span style="color: #007700">,&nbsp;</span><span style="color: #9876AA">JSON_FORCE_OBJECT</span><span style="color: #007700">),&nbsp;</span><span style="color: #DD0000">"\n\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #9876AA">$d&nbsp;</span><span style="color: #007700">=&nbsp;array(</span><span style="color: #DD0000">'foo'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'bar'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'baz'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'long'</span><span style="color: #007700">);<br /><br />echo&nbsp;</span><span style="color: #DD0000">"Associative&nbsp;array&nbsp;always&nbsp;output&nbsp;as&nbsp;object:&nbsp;"</span><span style="color: #007700">,&nbsp;</span><span style="color: #9876AA">json_encode</span><span style="color: #007700">(</span><span style="color: #9876AA">$d</span><span style="color: #007700">),&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #DD0000">"Associative&nbsp;array&nbsp;always&nbsp;output&nbsp;as&nbsp;object:&nbsp;"</span><span style="color: #007700">,&nbsp;</span><span style="color: #9876AA">json_encode</span><span style="color: #007700">(</span><span style="color: #9876AA">$d</span><span style="color: #007700">,&nbsp;</span><span style="color: #9876AA">JSON_FORCE_OBJECT</span><span style="color: #007700">),&nbsp;</span><span style="color: #DD0000">"\n\n"</span><span style="color: #007700">;<br /></span><span style="color: #9876AA">?&gt;</span> </span> </span></div>     </div>      <div class="example-contents"><p>以上例程会输出：</p></div>     <div class="example-contents screen" style="background:black;padding-left:5px;"> <div class="cdata"><span> Normal: [&quot;&lt;foo&gt;&quot;,&quot;&#039;bar&#039;&quot;,&quot;\&quot;baz\&quot;&quot;,&quot;&amp;blong&amp;&quot;,&quot;\u00e9&quot;] Tags: [&quot;\u003Cfoo\u003E&quot;,&quot;&#039;bar&#039;&quot;,&quot;\&quot;baz\&quot;&quot;,&quot;&amp;blong&amp;&quot;,&quot;\u00e9&quot;] Apos: [&quot;&lt;foo&gt;&quot;,&quot;\u0027bar\u0027&quot;,&quot;\&quot;baz\&quot;&quot;,&quot;&amp;blong&amp;&quot;,&quot;\u00e9&quot;] Quot: [&quot;&lt;foo&gt;&quot;,&quot;&#039;bar&#039;&quot;,&quot;\u0022baz\u0022&quot;,&quot;&amp;blong&amp;&quot;,&quot;\u00e9&quot;] Amp: [&quot;&lt;foo&gt;&quot;,&quot;&#039;bar&#039;&quot;,&quot;\&quot;baz\&quot;&quot;,&quot;\u0026blong\u0026&quot;,&quot;\u00e9&quot;] Unicode: [&quot;&lt;foo&gt;&quot;,&quot;&#039;bar&#039;&quot;,&quot;\&quot;baz\&quot;&quot;,&quot;&amp;blong&amp;&quot;,&quot;é&quot;] All: [&quot;\u003Cfoo\u003E&quot;,&quot;\u0027bar\u0027&quot;,&quot;\u0022baz\u0022&quot;,&quot;\u0026blong\u0026&quot;,&quot;é&quot;]  Empty array output as array: [] Empty array output as object: {}  Non-associative array output as array: [[1,2,3]] Non-associative array output as object: {&quot;0&quot;:{&quot;0&quot;:1,&quot;1&quot;:2,&quot;2&quot;:3}}  Associative array always output as object: {&quot;foo&quot;:&quot;bar&quot;,&quot;baz&quot;:&quot;long&quot;} Associative array always output as object: {&quot;foo&quot;:&quot;bar&quot;,&quot;baz&quot;:&quot;long&quot;} </span></div>     </div>    </div>    <div class="example" id="example-4516">     <p><strong>Example #3 选项 JSON_NUMERIC_CHECK 例子</strong></p>     <div class="example-contents"> <div class="phpcode" style="border-color:gray;background:#232525"><span><span style="color: #000000"> <span style="color: #9876AA">&lt;?php<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">"Strings&nbsp;representing&nbsp;numbers&nbsp;automatically&nbsp;turned&nbsp;into&nbsp;numbers"</span><span style="color: #007700">.</span><span style="color: #9876AA">PHP_EOL</span><span style="color: #007700">;<br /></span><span style="color: #9876AA">$numbers&nbsp;</span><span style="color: #007700">=&nbsp;array(</span><span style="color: #DD0000">'+123123'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'-123123'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'1.2e3'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'0.00001'</span><span style="color: #007700">);<br /></span><span style="color: #9876AA">var_dump</span><span style="color: #007700">(<br />&nbsp;</span><span style="color: #9876AA">$numbers</span><span style="color: #007700">,<br />&nbsp;</span><span style="color: #9876AA">json_encode</span><span style="color: #007700">(</span><span style="color: #9876AA">$numbers</span><span style="color: #007700">,&nbsp;</span><span style="color: #9876AA">JSON_NUMERIC_CHECK</span><span style="color: #007700">)<br />);<br />echo&nbsp;</span><span style="color: #DD0000">"Strings&nbsp;containing&nbsp;improperly&nbsp;formatted&nbsp;numbers"</span><span style="color: #007700">.</span><span style="color: #9876AA">PHP_EOL</span><span style="color: #007700">;<br /></span><span style="color: #9876AA">$strings&nbsp;</span><span style="color: #007700">=&nbsp;array(</span><span style="color: #DD0000">'+a33123456789'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'a123'</span><span style="color: #007700">);<br /></span><span style="color: #9876AA">var_dump</span><span style="color: #007700">(<br />&nbsp;</span><span style="color: #9876AA">$strings</span><span style="color: #007700">,<br />&nbsp;</span><span style="color: #9876AA">json_encode</span><span style="color: #007700">(</span><span style="color: #9876AA">$strings</span><span style="color: #007700">,&nbsp;</span><span style="color: #9876AA">JSON_NUMERIC_CHECK</span><span style="color: #007700">)<br />);<br /></span><span style="color: #9876AA">?&gt;</span> </span> </span></div>     </div>      <div class="example-contents"><p>以上例程的输出类似于：</p></div>     <div class="example-contents screen" style="background:black;padding-left:5px;"> <div class="cdata"><span> Strings representing numbers automatically turned into numbers array(4) {   [0]=&gt;   string(7) &quot;+123123&quot;   [1]=&gt;   string(7) &quot;-123123&quot;   [2]=&gt;   string(5) &quot;1.2e3&quot;   [3]=&gt;   string(7) &quot;0.00001&quot; } string(28) &quot;[123123,-123123,1200,1.0e-5]&quot; Strings containing improperly formatted numbers array(2) {   [0]=&gt;   string(13) &quot;+a33123456789&quot;   [1]=&gt;   string(4) &quot;a123&quot; } string(24) &quot;[&quot;+a33123456789&quot;,&quot;a123&quot;]&quot; </span></div>     </div>    </div>    <div class="example" id="example-4517">     <p><strong>Example #4 连续与非连续数组示例</strong></p>     <div class="example-contents"> <div class="phpcode" style="border-color:gray;background:#232525"><span><span style="color: #000000"> <span style="color: #9876AA">&lt;?php<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">"连续数组"</span><span style="color: #007700">.</span><span style="color: #9876AA">PHP_EOL</span><span style="color: #007700">;<br /></span><span style="color: #9876AA">$sequential&nbsp;</span><span style="color: #007700">=&nbsp;array(</span><span style="color: #DD0000">"foo"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"bar"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"baz"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"blong"</span><span style="color: #007700">);<br /></span><span style="color: #9876AA">var_dump</span><span style="color: #007700">(<br />&nbsp;</span><span style="color: #9876AA">$sequential</span><span style="color: #007700">,<br />&nbsp;</span><span style="color: #9876AA">json_encode</span><span style="color: #007700">(</span><span style="color: #9876AA">$sequential</span><span style="color: #007700">)<br />);<br /><br />echo&nbsp;</span><span style="color: #9876AA">PHP_EOL</span><span style="color: #007700">.</span><span style="color: #DD0000">"非连续数组"</span><span style="color: #007700">.</span><span style="color: #9876AA">PHP_EOL</span><span style="color: #007700">;<br /></span><span style="color: #9876AA">$nonsequential&nbsp;</span><span style="color: #007700">=&nbsp;array(</span><span style="color: #9876AA">1</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">"foo"</span><span style="color: #007700">,&nbsp;</span><span style="color: #9876AA">2</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">"bar"</span><span style="color: #007700">,&nbsp;</span><span style="color: #9876AA">3</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">"baz"</span><span style="color: #007700">,&nbsp;</span><span style="color: #9876AA">4</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">"blong"</span><span style="color: #007700">);<br /></span><span style="color: #9876AA">var_dump</span><span style="color: #007700">(<br />&nbsp;</span><span style="color: #9876AA">$nonsequential</span><span style="color: #007700">,<br />&nbsp;</span><span style="color: #9876AA">json_encode</span><span style="color: #007700">(</span><span style="color: #9876AA">$nonsequential</span><span style="color: #007700">)<br />);<br /><br />echo&nbsp;</span><span style="color: #9876AA">PHP_EOL</span><span style="color: #007700">.</span><span style="color: #DD0000">"删除一个连续数组值的方式产生的非连续数组"</span><span style="color: #007700">.</span><span style="color: #9876AA">PHP_EOL</span><span style="color: #007700">;<br />unset(</span><span style="color: #9876AA">$sequential</span><span style="color: #007700">[</span><span style="color: #9876AA">1</span><span style="color: #007700">]);<br /></span><span style="color: #9876AA">var_dump</span><span style="color: #007700">(<br />&nbsp;</span><span style="color: #9876AA">$sequential</span><span style="color: #007700">,<br />&nbsp;</span><span style="color: #9876AA">json_encode</span><span style="color: #007700">(</span><span style="color: #9876AA">$sequential</span><span style="color: #007700">)<br />);<br /></span><span style="color: #9876AA">?&gt;</span> </span> </span></div>     </div>      <div class="example-contents"><p>以上例程会输出：</p></div>     <div class="example-contents screen" style="background:black;padding-left:5px;"> <div class="cdata"><span> 连续数组 array(4) {   [0]=&gt;   string(3) &quot;foo&quot;   [1]=&gt;   string(3) &quot;bar&quot;   [2]=&gt;   string(3) &quot;baz&quot;   [3]=&gt;   string(5) &quot;blong&quot; } string(27) &quot;[&quot;foo&quot;,&quot;bar&quot;,&quot;baz&quot;,&quot;blong&quot;]&quot;  非连续数组 array(4) {   [1]=&gt;   string(3) &quot;foo&quot;   [2]=&gt;   string(3) &quot;bar&quot;   [3]=&gt;   string(3) &quot;baz&quot;   [4]=&gt;   string(5) &quot;blong&quot; } string(43) &quot;{&quot;1&quot;:&quot;foo&quot;,&quot;2&quot;:&quot;bar&quot;,&quot;3&quot;:&quot;baz&quot;,&quot;4&quot;:&quot;blong&quot;}&quot;  删除一个连续数组值的方式产生的非连续数组 array(3) {   [0]=&gt;   string(3) &quot;foo&quot;   [2]=&gt;   string(3) &quot;baz&quot;   [3]=&gt;   string(5) &quot;blong&quot; } string(33) &quot;{&quot;0&quot;:&quot;foo&quot;,&quot;2&quot;:&quot;baz&quot;,&quot;3&quot;:&quot;blong&quot;}&quot; </span></div>     </div>    </div>    <div class="example" id="example-4518">     <p><strong>Example #5 <strong><span>选项 JSON_PRESERVE_ZERO_FRACTION</span></strong> 的例子</strong></p>     <div class="example-contents"> <div class="phpcode" style="border-color:gray;background:#232525"><span><span style="color: #000000"> <span style="color: #9876AA">&lt;?php<br />var_dump</span><span style="color: #007700">(</span><span style="color: #9876AA">json_encode</span><span style="color: #007700">(</span><span style="color: #9876AA">12.0</span><span style="color: #007700">,&nbsp;</span><span style="color: #9876AA">JSON_PRESERVE_ZERO_FRACTION</span><span style="color: #007700">));<br /></span><span style="color: #9876AA">var_dump</span><span style="color: #007700">(</span><span style="color: #9876AA">json_encode</span><span style="color: #007700">(</span><span style="color: #9876AA">12.0</span><span style="color: #007700">));<br /></span><span style="color: #9876AA">?&gt;</span> </span> </span></div>     </div>      <div class="example-contents"><p>以上例程会输出：</p></div>     <div class="example-contents screen" style="background:black;padding-left:5px;"> <div class="cdata"><span> string(4) &quot;12.0&quot; string(2) &quot;12&quot; </span></div>     </div>    </div>   </span>  </div>     <br></br><div style="BORDER-TOP: gray 1px dashed; OVERFLOW: hidden; HEIGHT: 1px"></div><div class="refsect1 notes" id="refsect1-function.json-encode-notes">   <h3 class="title">注释</h3>   <blockquote class="note" style="border:1px gray solid"><p><strong class="note" style="border:1px gray solid">Note</strong>:     <p class="para">     如果执行失败，可以通过 <span class="function">{@link json_last_error()}</span> 函数来获取详细错误信息。    </p>   </p></blockquote>   <blockquote class="note" style="border:1px gray solid"><p><strong class="note" style="border:1px gray solid">Note</strong>:     <p class="para">     如果要编码的数组的键不是从0开始的数字，所有的键将会被当作字符串，并明确声明为 key-value 对。    </p>   </p></blockquote>      <blockquote class="note" style="border:1px gray solid"><p><strong class="note" style="border:1px gray solid">Note</strong>:     <p class="para">     Like the reference JSON encoder, <span class="function"><strong style="color:#CC7832">json_encode()</strong></span> will     generate JSON that is a simple value (that is, neither an object nor an     array) if given a <span class="type" style="color:#EAB766"><a href="http://php.net/manual/zh/language.types.string.php" class="type string" style="color:#EAB766">string</a></span>, <span class="type" style="color:#EAB766"><a href="http://php.net/manual/zh/language.types.integer.php" class="type integer" style="color:#EAB766">integer</a></span>,     <span class="type" style="color:#EAB766"><a href="http://php.net/manual/zh/language.types.float.php" class="type float" style="color:#EAB766">float</a></span> or <span class="type" style="color:#EAB766"><a href="http://php.net/manual/zh/language.types.boolean.php" class="type boolean" style="color:#EAB766">boolean</a></span> as an input     <span class="parameter" style="color:#2EACF9">value</span>. While most decoders will accept these values     as valid JSON, some may not, as the specification is ambiguous on this     point.    </p>    <p class="para">     总而言之，应该测试下 JSON decoder 能否处理 <span class="function"><strong style="color:#CC7832">json_encode()</strong></span> 生成的数据。    </p>   </p></blockquote>  </div>    <br></br><div style="BORDER-TOP: gray 1px dashed; OVERFLOW: hidden; HEIGHT: 1px"></div><div class="refsect1 seealso" id="refsect1-function.json-encode-seealso">   <h3 class="title">参见</h3>   <span>    <ul class="simplelist">     <li class="member"><span class="interfacename"><a href="http://php.net/manual/zh/class.jsonserializable.php" class="interfacename">JsonSerializable</a></span></li>     <li class="member"><span class="function">{@link json_decode()} - 对 JSON 格式的字符串进行解码</span></li>     <li class="member"><span class="function">{@link json_last_error()} - 返回最后发生的错误</span></li>     <li class="member"><span class="function">{@link serialize()} - 产生一个可存储的值的表示</span></li>    </ul>   </span>  </div>  <div class="up"><a href="http://php.net/manual/zh/ref.json.php">JSON 函数</a></div></div>
 * @return string a JSON encoded string on success or <b>FALSE</b> on failure.*/
function json_encode ($value, $options = 0, $depth = 512) {}

/**
*<div id="function.json-decode" class="refentry">  <div class="refnamediv">   <h1 class="refname">json_decode</h1>   <p class="verinfo">(PHP 5 &gt;= 5.2.0, PHP 7, PECL json &gt;= 1.2.0)</p><p class="refpurpose"><span class="refname">json_decode</span> &mdash; <span class="dc-title">对 JSON 格式的字符串进行解码</span></p>   </div>    <br></br><div style="BORDER-TOP: gray 1px dashed; OVERFLOW: hidden; HEIGHT: 1px"></div><div class="refsect1 description" id="refsect1-function.json-decode-description">   <h3 class="title">说明</h3>   <div class="methodsynopsis dc-description" style="border:1px gray;padding-left:5px;background:#232525">    <span class="type" style="color:#EAB766"><a href="http://php.net/manual/zh/language.pseudo-types.php#language.types.mixed" class="type mixed" style="color:#EAB766">mixed</a></span> <span class="methodname" style="color:#CC7832"><strong>json_decode</strong></span>     ( <span class="methodparam"><span class="type" style="color:#EAB766">string</span> <span class="parameter" style="color:#2EACF9">$json</span></span>    [, <span class="methodparam"><span class="type" style="color:#EAB766">bool</span> <span class="parameter" style="color:#2EACF9">$assoc</span><span class="initializer"> = false</span></span>    [, <span class="methodparam"><span class="type" style="color:#EAB766">int</span> <span class="parameter" style="color:#2EACF9">$depth</span><span class="initializer"> = 512</span></span>    [, <span class="methodparam"><span class="type" style="color:#EAB766">int</span> <span class="parameter" style="color:#2EACF9">$options</span><span class="initializer"> = 0</span></span>   ]]] )</div>    <p class="para rdfs-comment">    接受一个 JSON 编码的字符串并且把它转换为 PHP 变量   </p>  </div>     <br></br><div style="BORDER-TOP: gray 1px dashed; OVERFLOW: hidden; HEIGHT: 1px"></div><div class="refsect1 parameters" id="refsect1-function.json-decode-parameters">   <h3 class="title">参数</h3>   <span>    <dl>            <dt> <span class="parameter" style="color:#2EACF9">json</span></dt>       <dd>        <p class="para">        待解码的 <span class="parameter" style="color:#2EACF9">json</span> <span class="type" style="color:#EAB766"><a href="http://php.net/manual/zh/language.types.string.php" class="type string" style="color:#EAB766">string</a></span> 格式的字符串。       </p>       <p class="para">        这个函数仅能处理 UTF-8 编码的数据。       </p>         <blockquote class="note" style="border:1px gray solid"><p><strong class="note" style="border:1px gray solid">Note</strong>:    <p class="para">    PHP implements a superset of JSON as specified in the original    <a href="http://www.faqs.org/rfcs/rfc7159" class="link external">&raquo;&nbsp;RFC 7159</a>.   </p>  </p></blockquote>       </dd>                 <dt> <span class="parameter" style="color:#2EACF9">assoc</span></dt>       <dd>        <p class="para">        当该参数为 <strong><span>TRUE</span></strong> 时，将返回 <span class="type" style="color:#EAB766"><a href="http://php.net/manual/zh/language.types.array.php" class="type array" style="color:#EAB766">array</a></span> 而非 <span class="type" style="color:#EAB766"><a href="http://php.net/manual/zh/language.types.object.php" class="type object" style="color:#EAB766">object</a></span> 。       </p>      </dd>                 <dt> <span class="parameter" style="color:#2EACF9">depth</span></dt>       <dd>        <p class="para">        指定递归深度。       </p>      </dd>                 <dt> <span class="parameter" style="color:#2EACF9">options</span></dt>       <dd>        <p class="para">        JSON解码的掩码选项。 现在有两个支持的选项。        第一个是<strong><span>JSON_BIGINT_AS_STRING</span></strong>，        用于将大整数转为字符串而非默认的float类型。第二个是        <strong><span>JSON_OBJECT_AS_ARRAY</span></strong>，        与将<span class="parameter" style="color:#2EACF9">assoc</span>设置为 <strong><span>TRUE</span></strong> 有相同的效果。       </p>      </dd>          </dl>    </span>  </div>     <br></br><div style="BORDER-TOP: gray 1px dashed; OVERFLOW: hidden; HEIGHT: 1px"></div><div class="refsect1 returnvalues" id="refsect1-function.json-decode-returnvalues">   <h3 class="title">返回值</h3>   <p class="para">    Returns the value encoded in <span class="parameter" style="color:#2EACF9">json</span> in appropriate    PHP type. Values <em>true</em>, <em>false</em> and    <em>null</em> are returned as <strong><span>TRUE</span></strong>, <strong><span>FALSE</span></strong> and <strong><span>NULL</span></strong>    respectively. <strong><span>NULL</span></strong> is returned if the <span class="parameter" style="color:#2EACF9">json</span> cannot    be decoded or if the encoded data is deeper than the recursion limit.   </p>  </div>     <br></br><div style="BORDER-TOP: gray 1px dashed; OVERFLOW: hidden; HEIGHT: 1px"></div><div class="refsect1 examples" id="refsect1-function.json-decode-examples">   <h3 class="title">范例</h3>   <span>    <div class="example" id="example-4509">     <p><strong>Example #1 <span class="function"><strong style="color:#CC7832">json_decode()</strong></span> 的例子</strong></p>     <div class="example-contents"> <div class="phpcode" style="border-color:gray;background:#232525"><span><span style="color: #000000"> <span style="color: #9876AA">&lt;?php<br />$json&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'{"a":1,"b":2,"c":3,"d":4,"e":5}'</span><span style="color: #007700">;<br /><br /></span><span style="color: #9876AA">var_dump</span><span style="color: #007700">(</span><span style="color: #9876AA">json_decode</span><span style="color: #007700">(</span><span style="color: #9876AA">$json</span><span style="color: #007700">));<br /></span><span style="color: #9876AA">var_dump</span><span style="color: #007700">(</span><span style="color: #9876AA">json_decode</span><span style="color: #007700">(</span><span style="color: #9876AA">$json</span><span style="color: #007700">,&nbsp;</span><span style="color: #9876AA">true</span><span style="color: #007700">));<br /><br /></span><span style="color: #9876AA">?&gt;</span> </span> </span></div>     </div>      <div class="example-contents"><p>以上例程会输出：</p></div>     <div class="example-contents screen" style="background:black;padding-left:5px;"> <div class="cdata"><span> object(stdClass)#1 (5) {     [&quot;a&quot;] =&gt; int(1)     [&quot;b&quot;] =&gt; int(2)     [&quot;c&quot;] =&gt; int(3)     [&quot;d&quot;] =&gt; int(4)     [&quot;e&quot;] =&gt; int(5) }  array(5) {     [&quot;a&quot;] =&gt; int(1)     [&quot;b&quot;] =&gt; int(2)     [&quot;c&quot;] =&gt; int(3)     [&quot;d&quot;] =&gt; int(4)     [&quot;e&quot;] =&gt; int(5) } </span></div>     </div>    </div>    <div class="example" id="example-4510">     <p><strong>Example #2 Accessing invalid object properties</strong></p>     <div class="example-contents"><p>      Accessing elements within an object that contain characters not      permitted under PHP&#039;s naming convention (e.g. the hyphen) can be      accomplished by encapsulating the element name within braces and the apostrophe.     </p></div>     <div class="example-contents"> <div class="phpcode" style="border-color:gray;background:#232525"><span><span style="color: #000000"> <span style="color: #9876AA">&lt;?php<br /><br />$json&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'{"foo-bar":&nbsp;12345}'</span><span style="color: #007700">;<br /><br /></span><span style="color: #9876AA">$obj&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #9876AA">json_decode</span><span style="color: #007700">(</span><span style="color: #9876AA">$json</span><span style="color: #007700">);<br />print&nbsp;</span><span style="color: #9876AA">$obj</span><span style="color: #007700">-&gt;{</span><span style="color: #DD0000">'foo-bar'</span><span style="color: #007700">};&nbsp;</span><span style="color: #FF8000">//&nbsp;12345<br /><br /></span><span style="color: #9876AA">?&gt;</span> </span> </span></div>     </div>     </div>    <div class="example" id="example-4511">     <p><strong>Example #3 common mistakes using <span class="function"><strong style="color:#CC7832">json_decode()</strong></span></strong></p>     <div class="example-contents"> <div class="phpcode" style="border-color:gray;background:#232525"><span><span style="color: #000000"> <span style="color: #9876AA">&lt;?php<br /><br /></span><span style="color: #FF8000">//&nbsp;the&nbsp;following&nbsp;strings&nbsp;are&nbsp;valid&nbsp;JavaScript&nbsp;but&nbsp;not&nbsp;valid&nbsp;JSON<br /><br />//&nbsp;the&nbsp;name&nbsp;and&nbsp;value&nbsp;must&nbsp;be&nbsp;enclosed&nbsp;in&nbsp;double&nbsp;quotes<br />//&nbsp;single&nbsp;quotes&nbsp;are&nbsp;not&nbsp;valid&nbsp;<br /></span><span style="color: #9876AA">$bad_json&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"{&nbsp;'bar':&nbsp;'baz'&nbsp;}"</span><span style="color: #007700">;<br /></span><span style="color: #9876AA">json_decode</span><span style="color: #007700">(</span><span style="color: #9876AA">$bad_json</span><span style="color: #007700">);&nbsp;</span><span style="color: #FF8000">//&nbsp;null<br /><br />//&nbsp;the&nbsp;name&nbsp;must&nbsp;be&nbsp;enclosed&nbsp;in&nbsp;double&nbsp;quotes<br /></span><span style="color: #9876AA">$bad_json&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'{&nbsp;bar:&nbsp;"baz"&nbsp;}'</span><span style="color: #007700">;<br /></span><span style="color: #9876AA">json_decode</span><span style="color: #007700">(</span><span style="color: #9876AA">$bad_json</span><span style="color: #007700">);&nbsp;</span><span style="color: #FF8000">//&nbsp;null<br /><br />//&nbsp;trailing&nbsp;commas&nbsp;are&nbsp;not&nbsp;allowed<br /></span><span style="color: #9876AA">$bad_json&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'{&nbsp;bar:&nbsp;"baz",&nbsp;}'</span><span style="color: #007700">;<br /></span><span style="color: #9876AA">json_decode</span><span style="color: #007700">(</span><span style="color: #9876AA">$bad_json</span><span style="color: #007700">);&nbsp;</span><span style="color: #FF8000">//&nbsp;null<br /><br /></span><span style="color: #9876AA">?&gt;</span> </span> </span></div>     </div>     </div>    <div class="example" id="example-4512">     <p><strong>Example #4 <span class="parameter" style="color:#2EACF9">depth</span> errors</strong></p>     <div class="example-contents"> <div class="phpcode" style="border-color:gray;background:#232525"><span><span style="color: #000000"> <span style="color: #9876AA">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;Encode&nbsp;the&nbsp;data.<br /></span><span style="color: #9876AA">$json&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #9876AA">json_encode</span><span style="color: #007700">(<br />&nbsp;&nbsp;&nbsp;&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #9876AA">1&nbsp;</span><span style="color: #007700">=&gt;&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'English'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'One'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'January'<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'French'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'Une'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'Janvier'<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;)<br />&nbsp;&nbsp;&nbsp;&nbsp;)<br />);<br /><br /></span><span style="color: #FF8000">//&nbsp;Define&nbsp;the&nbsp;errors.<br /></span><span style="color: #9876AA">$constants&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #9876AA">get_defined_constants</span><span style="color: #007700">(</span><span style="color: #9876AA">true</span><span style="color: #007700">);<br /></span><span style="color: #9876AA">$json_errors&nbsp;</span><span style="color: #007700">=&nbsp;array();<br />foreach&nbsp;(</span><span style="color: #9876AA">$constants</span><span style="color: #007700">[</span><span style="color: #DD0000">"json"</span><span style="color: #007700">]&nbsp;as&nbsp;</span><span style="color: #9876AA">$name&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #9876AA">$value</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(!</span><span style="color: #9876AA">strncmp</span><span style="color: #007700">(</span><span style="color: #9876AA">$name</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"JSON_ERROR_"</span><span style="color: #007700">,&nbsp;</span><span style="color: #9876AA">11</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #9876AA">$json_errors</span><span style="color: #007700">[</span><span style="color: #9876AA">$value</span><span style="color: #007700">]&nbsp;=&nbsp;</span><span style="color: #9876AA">$name</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}<br /><br /></span><span style="color: #FF8000">//&nbsp;Show&nbsp;the&nbsp;errors&nbsp;for&nbsp;different&nbsp;depths.<br /></span><span style="color: #007700">foreach&nbsp;(</span><span style="color: #9876AA">range</span><span style="color: #007700">(</span><span style="color: #9876AA">4</span><span style="color: #007700">,&nbsp;</span><span style="color: #9876AA">3</span><span style="color: #007700">,&nbsp;-</span><span style="color: #9876AA">1</span><span style="color: #007700">)&nbsp;as&nbsp;</span><span style="color: #9876AA">$depth</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #9876AA">var_dump</span><span style="color: #007700">(</span><span style="color: #9876AA">json_decode</span><span style="color: #007700">(</span><span style="color: #9876AA">$json</span><span style="color: #007700">,&nbsp;</span><span style="color: #9876AA">true</span><span style="color: #007700">,&nbsp;</span><span style="color: #9876AA">$depth</span><span style="color: #007700">));<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'Last&nbsp;error:&nbsp;'</span><span style="color: #007700">,&nbsp;</span><span style="color: #9876AA">$json_errors</span><span style="color: #007700">[</span><span style="color: #9876AA">json_last_error</span><span style="color: #007700">()],&nbsp;</span><span style="color: #9876AA">PHP_EOL</span><span style="color: #007700">,&nbsp;</span><span style="color: #9876AA">PHP_EOL</span><span style="color: #007700">;<br />}<br /></span><span style="color: #9876AA">?&gt;</span> </span> </span></div>     </div>      <div class="example-contents"><p>以上例程会输出：</p></div>     <div class="example-contents screen" style="background:black;padding-left:5px;"> <div class="cdata"><span> array(1) {   [1]=&gt;   array(2) {     [&quot;English&quot;]=&gt;     array(2) {       [0]=&gt;       string(3) &quot;One&quot;       [1]=&gt;       string(7) &quot;January&quot;     }     [&quot;French&quot;]=&gt;     array(2) {       [0]=&gt;       string(3) &quot;Une&quot;       [1]=&gt;       string(7) &quot;Janvier&quot;     }   } } Last error: JSON_ERROR_NONE  NULL Last error: JSON_ERROR_DEPTH </span></div>     </div>    </div>    <div class="example" id="example-4513">     <p><strong>Example #5 <span class="function"><strong style="color:#CC7832">json_decode()</strong></span> of large integers</strong></p>     <div class="example-contents"> <div class="phpcode" style="border-color:gray;background:#232525"><span><span style="color: #000000"> <span style="color: #9876AA">&lt;?php<br />$json&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'{"number":&nbsp;12345678901234567890}'</span><span style="color: #007700">;<br /><br /></span><span style="color: #9876AA">var_dump</span><span style="color: #007700">(</span><span style="color: #9876AA">json_decode</span><span style="color: #007700">(</span><span style="color: #9876AA">$json</span><span style="color: #007700">));<br /></span><span style="color: #9876AA">var_dump</span><span style="color: #007700">(</span><span style="color: #9876AA">json_decode</span><span style="color: #007700">(</span><span style="color: #9876AA">$json</span><span style="color: #007700">,&nbsp;</span><span style="color: #9876AA">false</span><span style="color: #007700">,&nbsp;</span><span style="color: #9876AA">512</span><span style="color: #007700">,&nbsp;</span><span style="color: #9876AA">JSON_BIGINT_AS_STRING</span><span style="color: #007700">));<br /><br /></span><span style="color: #9876AA">?&gt;</span> </span> </span></div>     </div>      <div class="example-contents"><p>以上例程会输出：</p></div>     <div class="example-contents screen" style="background:black;padding-left:5px;"> <div class="cdata"><span> object(stdClass)#1 (1) {   [&quot;number&quot;]=&gt;   float(1.2345678901235E+19) } object(stdClass)#1 (1) {   [&quot;number&quot;]=&gt;   string(20) &quot;12345678901234567890&quot; } </span></div>     </div>    </div>   </span>  </div>     <br></br><div style="BORDER-TOP: gray 1px dashed; OVERFLOW: hidden; HEIGHT: 1px"></div><div class="refsect1 notes" id="refsect1-function.json-decode-notes">   <h3 class="title">注释</h3>   <blockquote class="note" style="border:1px gray solid"><p><strong class="note" style="border:1px gray solid">Note</strong>:     <p class="para">     The JSON spec is not JavaScript, but a subset of JavaScript.    </p>   </p></blockquote>   <blockquote class="note" style="border:1px gray solid"><p><strong class="note" style="border:1px gray solid">Note</strong>:     <p class="para">     In the event of a failure to decode, <span class="function">{@link json_last_error()}</span>     can be used to determine the exact nature of the error.    </p>   </p></blockquote>  </div>     <br></br><div style="BORDER-TOP: gray 1px dashed; OVERFLOW: hidden; HEIGHT: 1px"></div><div class="refsect1 changelog" id="refsect1-function.json-decode-changelog">   <h3 class="title">更新日志</h3>   <span>    <table class="doctable informaltable">           <thead>       <tr>        <th>版本</th>        <th>说明</th>       </tr>       </thead>       <tbody class="tbody">       <tr>        <td>7.1.0</td>        <td>         An empty JSON key (&quot;&quot;) can be encoded to the empty object property         instead of using a key with value <em>_empty_</em>.        </td>       </tr>        <tr>        <td>7.0.0</td>        <td>         Rejected RFC 7159 incompatible number formats - top level         (07, 0xff, .1, -.1) and all levels ([1.], [1.e1])        </td>       </tr>        <tr>        <td>7.0.0</td>        <td>         An empty PHP string or value that after casting to string is an empty         string (<em>NULL</em>, <em>FALSE</em>) results         in JSON syntax error.        </td>       </tr>       <tr>        <td>5.6.0</td>        <td>         Invalid non-lowercased variants of the <em>true</em>,         <em>false</em> and <em>null</em> literals are no         longer accepted as valid input, and will generate warnings.        </td>       </tr>        <tr>        <td>5.4.0</td>        <td>         The <span class="parameter" style="color:#2EACF9">options</span> parameter was added.        </td>       </tr>        <tr>        <td>5.3.0</td>        <td>Added the optional <span class="parameter" style="color:#2EACF9">depth</span>. The default recursion depth was increased from 128 to 512</td>       </tr>        <tr>        <td>5.2.3</td>        <td>The nesting limit was increased from 20 to 128</td>       </tr>        <tr>        <td>5.2.1</td>        <td>         Added support for JSON decoding of basic types.        </td>       </tr>       </tbody>         </table>    </span>  </div>     <br></br><div style="BORDER-TOP: gray 1px dashed; OVERFLOW: hidden; HEIGHT: 1px"></div><div class="refsect1 seealso" id="refsect1-function.json-decode-seealso">   <h3 class="title">参见</h3>   <span>    <ul class="simplelist">     <li class="member"><span class="function">{@link json_encode()} - 对变量进行 JSON 编码</span></li>     <li class="member"><span class="function">{@link json_last_error()} - 返回最后发生的错误</span></li>    </ul>   </span>  </div>  <div class="up"><a href="http://php.net/manual/zh/ref.json.php">JSON 函数</a></div></div>
 * @return mixed the value encoded in <i>json</i> in appropriate*/
function json_decode ($json, $assoc = false, $depth = 512, $options = 0) {}

/**
*<div id="function.json-last-error" class="refentry">  <div class="refnamediv">   <h1 class="refname">json_last_error</h1>   <p class="verinfo">(PHP 5 &gt;= 5.3.0, PHP 7)</p><p class="refpurpose"><span class="refname">json_last_error</span> &mdash; <span class="dc-title">返回最后发生的错误</span></p>   </div>   <br></br><div style="BORDER-TOP: gray 1px dashed; OVERFLOW: hidden; HEIGHT: 1px"></div><div class="refsect1 description" id="refsect1-function.json-last-error-description">   <h3 class="title">说明</h3>   <div class="methodsynopsis dc-description" style="border:1px gray;padding-left:5px;background:#232525">    <span class="type" style="color:#EAB766">int</span> <span class="methodname" style="color:#CC7832"><strong>json_last_error</strong></span>     ( <span class="methodparam">void</span>    )</div>    <p class="para rdfs-comment">    如果有，返回 JSON 编码解码时最后发生的错误。   </p>  </div>    <br></br><div style="BORDER-TOP: gray 1px dashed; OVERFLOW: hidden; HEIGHT: 1px"></div><div class="refsect1 parameters" id="refsect1-function.json-last-error-parameters">   <h3 class="title">参数</h3>   <span>此函数没有参数。</span>  </div>    <br></br><div style="BORDER-TOP: gray 1px dashed; OVERFLOW: hidden; HEIGHT: 1px"></div><div class="refsect1 returnvalues" id="refsect1-function.json-last-error-returnvalues">   <h3 class="title">返回值</h3>   <p class="para">    返回一个整型（integer），这个值会是以下的常量之一：   </p>   <table class="doctable table">    <caption><strong>JSON 错误码</strong></caption>         <thead>      <tr>       <th>常量</th>       <th>含义</th>       <th>可用性</th>      </tr>      </thead>      <tbody class="tbody">      <tr>       <td><strong><span>JSON_ERROR_NONE</span></strong></td>       <td>没有错误发生</td>       <td class="empty">&nbsp;</td>      </tr>       <tr>       <td><strong><span>JSON_ERROR_DEPTH</span></strong></td>       <td>到达了最大堆栈深度</td>       <td class="empty">&nbsp;</td>      </tr>       <tr>       <td><strong><span>JSON_ERROR_STATE_MISMATCH</span></strong></td>       <td>无效或异常的 JSON</td>       <td class="empty">&nbsp;</td>      </tr>       <tr>       <td><strong><span>JSON_ERROR_CTRL_CHAR</span></strong></td>       <td>控制字符错误，可能是编码不对</td>       <td class="empty">&nbsp;</td>      </tr>       <tr>       <td><strong><span>JSON_ERROR_SYNTAX</span></strong></td>       <td>语法错误</td>       <td class="empty">&nbsp;</td>      </tr>       <tr>       <td><strong><span>JSON_ERROR_UTF8</span></strong></td>       <td>异常的 UTF-8 字符，也许是因为不正确的编码。</td>       <td>PHP 5.3.3</td>      </tr>       <tr>       <td><strong><span>JSON_ERROR_RECURSION</span></strong></td>       <td>One or more recursive references in the value to be encoded</td>       <td>PHP 5.5.0</td>      </tr>       <tr>       <td><strong><span>JSON_ERROR_INF_OR_NAN</span></strong></td>       <td>        One or more        <a href="http://php.net/manual/zh/language.types.float.php#language.types.float.nan" class="link"><strong><span>NAN</span></strong></a>        or {@link <strong><code>INF</code></strong>}        values in the value to be encoded       </td>       <td>PHP 5.5.0</td>      </tr>       <tr>       <td><strong><span>JSON_ERROR_UNSUPPORTED_TYPE</span></strong></td>       <td>指定的类型，值无法编码。</td>       <td>PHP 5.5.0</td>      </tr>       <tr>       <td><strong><span>JSON_ERROR_INVALID_PROPERTY_NAME</span></strong></td>       <td>指定的属性名无法编码。</td>       <td>PHP 7.0.0</td>      </tr>       <tr>       <td><strong><span>JSON_ERROR_UTF16</span></strong></td>       <td>畸形的 UTF-16 字符，可能因为字符编码不正确。</td>       <td>PHP 7.0.0</td>      </tr>      </tbody>       </table>   </div>    <br></br><div style="BORDER-TOP: gray 1px dashed; OVERFLOW: hidden; HEIGHT: 1px"></div><div class="refsect1 examples" id="refsect1-function.json-last-error-examples">   <h3 class="title">范例</h3>   <span>    <div class="example" id="example-4519">     <p><strong>Example #1 <span class="function"><strong style="color:#CC7832">json_last_error()</strong></span> 例子</strong></p>     <div class="example-contents"> <div class="phpcode" style="border-color:gray;background:#232525"><span><span style="color: #000000"> <span style="color: #9876AA">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;一个有效的&nbsp;json&nbsp;字符串<br /></span><span style="color: #9876AA">$json</span><span style="color: #007700">[]&nbsp;=&nbsp;</span><span style="color: #DD0000">'{"Organization":&nbsp;"PHP&nbsp;Documentation&nbsp;Team"}'</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">//&nbsp;一个无效的&nbsp;json&nbsp;字符串会导致一个语法错误，在这个例子里我们使用&nbsp;'&nbsp;代替了&nbsp;"&nbsp;作为引号<br /></span><span style="color: #9876AA">$json</span><span style="color: #007700">[]&nbsp;=&nbsp;</span><span style="color: #DD0000">"{'Organization':&nbsp;'PHP&nbsp;Documentation&nbsp;Team'}"</span><span style="color: #007700">;<br /><br /><br />foreach&nbsp;(</span><span style="color: #9876AA">$json&nbsp;</span><span style="color: #007700">as&nbsp;</span><span style="color: #9876AA">$string</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'Decoding:&nbsp;'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #9876AA">$string</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #9876AA">json_decode</span><span style="color: #007700">(</span><span style="color: #9876AA">$string</span><span style="color: #007700">);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;switch&nbsp;(</span><span style="color: #9876AA">json_last_error</span><span style="color: #007700">())&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case&nbsp;</span><span style="color: #9876AA">JSON_ERROR_NONE</span><span style="color: #007700">:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'&nbsp;-&nbsp;No&nbsp;errors'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case&nbsp;</span><span style="color: #9876AA">JSON_ERROR_DEPTH</span><span style="color: #007700">:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'&nbsp;-&nbsp;Maximum&nbsp;stack&nbsp;depth&nbsp;exceeded'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case&nbsp;</span><span style="color: #9876AA">JSON_ERROR_STATE_MISMATCH</span><span style="color: #007700">:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'&nbsp;-&nbsp;Underflow&nbsp;or&nbsp;the&nbsp;modes&nbsp;mismatch'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case&nbsp;</span><span style="color: #9876AA">JSON_ERROR_CTRL_CHAR</span><span style="color: #007700">:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'&nbsp;-&nbsp;Unexpected&nbsp;control&nbsp;character&nbsp;found'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case&nbsp;</span><span style="color: #9876AA">JSON_ERROR_SYNTAX</span><span style="color: #007700">:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'&nbsp;-&nbsp;Syntax&nbsp;error,&nbsp;malformed&nbsp;JSON'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case&nbsp;</span><span style="color: #9876AA">JSON_ERROR_UTF8</span><span style="color: #007700">:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'&nbsp;-&nbsp;Malformed&nbsp;UTF-8&nbsp;characters,&nbsp;possibly&nbsp;incorrectly&nbsp;encoded'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;default:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'&nbsp;-&nbsp;Unknown&nbsp;error'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #9876AA">PHP_EOL</span><span style="color: #007700">;<br />}<br /></span><span style="color: #9876AA">?&gt;</span> </span> </span></div>     </div>      <div class="example-contents"><p>以上例程会输出：</p></div>     <div class="example-contents screen" style="background:black;padding-left:5px;"> <div class="cdata"><span> Decoding: {&quot;Organization&quot;: &quot;PHP Documentation Team&quot;} - No errors Decoding: {&#039;Organization&#039;: &#039;PHP Documentation Team&#039;} - Syntax error, malformed JSON </span></div>     </div>    </div>   </span>   <p class="para">    <div class="example" id="example-4520">     <p><strong>Example #2 <span class="function">{@link json_encode()}</span> 的 <span class="function"><strong style="color:#CC7832">json_last_error()</strong></span></strong></p>     <div class="example-contents"> <div class="phpcode" style="border-color:gray;background:#232525"><span><span style="color: #000000"> <span style="color: #9876AA">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;无效的&nbsp;UTF8&nbsp;序列<br /></span><span style="color: #9876AA">$text&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"\xB1\x31"</span><span style="color: #007700">;<br /><br /></span><span style="color: #9876AA">$json&nbsp;&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #9876AA">json_encode</span><span style="color: #007700">(</span><span style="color: #9876AA">$text</span><span style="color: #007700">);<br /></span><span style="color: #9876AA">$error&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #9876AA">json_last_error</span><span style="color: #007700">();<br /><br /></span><span style="color: #9876AA">var_dump</span><span style="color: #007700">(</span><span style="color: #9876AA">$json</span><span style="color: #007700">,&nbsp;</span><span style="color: #9876AA">$error&nbsp;</span><span style="color: #007700">===&nbsp;</span><span style="color: #9876AA">JSON_ERROR_UTF8</span><span style="color: #007700">);<br /></span><span style="color: #9876AA">?&gt;</span> </span> </span></div>     </div>      <div class="example-contents"><p>以上例程会输出：</p></div>     <div class="example-contents screen" style="background:black;padding-left:5px;"> <div class="cdata"><span> string(4) &quot;null&quot; bool(true) </span></div>     </div>    </div>   </p>  </div>    <br></br><div style="BORDER-TOP: gray 1px dashed; OVERFLOW: hidden; HEIGHT: 1px"></div><div class="refsect1 seealso" id="refsect1-function.json-last-error-seealso">   <h3 class="title">参见</h3>   <span>    <ul class="simplelist">     <li class="member"><span class="function">{@link json_last_error_msg()} - Returns the error string of the last json_encode() or json_decode() call</span></li>     <li class="member"><span class="function">{@link json_decode()} - 对 JSON 格式的字符串进行解码</span></li>     <li class="member"><span class="function">{@link json_encode()} - 对变量进行 JSON 编码</span></li>    </ul>   </span>  </div>  <div class="up"><a href="http://php.net/manual/zh/ref.json.php">JSON 函数</a></div></div>
 * @return int an integer, the value can be one of the following*/
function json_last_error () {}

/**
*<div id="function.json-last-error-msg" class="refentry">  <div class="refnamediv">   <h1 class="refname">json_last_error_msg</h1>   <p class="verinfo">(PHP 5 &gt;= 5.5.0, PHP 7)</p><p class="refpurpose"><span class="refname">json_last_error_msg</span> &mdash; <span class="dc-title">Returns the error string of the last json_encode() or json_decode() call</span></p>   </div>   <br></br><div style="BORDER-TOP: gray 1px dashed; OVERFLOW: hidden; HEIGHT: 1px"></div><div class="refsect1 description" id="refsect1-function.json-last-error-msg-description">   <h3 class="title">说明</h3>   <div class="methodsynopsis dc-description" style="border:1px gray;padding-left:5px;background:#232525">    <span class="type" style="color:#EAB766">string</span> <span class="methodname" style="color:#CC7832"><strong>json_last_error_msg</strong></span>     ( <span class="methodparam">void</span>    )</div>    <p class="para rdfs-comment">    </p>   </div>    <br></br><div style="BORDER-TOP: gray 1px dashed; OVERFLOW: hidden; HEIGHT: 1px"></div><div class="refsect1 parameters" id="refsect1-function.json-last-error-msg-parameters">   <h3 class="title">参数</h3>   <span>此函数没有参数。</span>  </div>    <br></br><div style="BORDER-TOP: gray 1px dashed; OVERFLOW: hidden; HEIGHT: 1px"></div><div class="refsect1 returnvalues" id="refsect1-function.json-last-error-msg-returnvalues">   <h3 class="title">返回值</h3>   <p class="para">    Returns the error message on success, <em>&quot;No error&quot;</em> if no    error has occurred,  或者在失败时返回 <strong><span>FALSE</span></strong>.   </p>  </div>    <br></br><div style="BORDER-TOP: gray 1px dashed; OVERFLOW: hidden; HEIGHT: 1px"></div><div class="refsect1 seealso" id="refsect1-function.json-last-error-msg-seealso">   <h3 class="title">参见</h3>   <span>    <ul class="simplelist">     <li class="member"><span class="function">{@link json_last_error()} - 返回最后发生的错误</span></li>    </ul>   </span>  </div>   <div class="up"><a href="http://php.net/manual/zh/ref.json.php">JSON 函数</a></div></div>
 * @return string the error message on success or <b>NULL</b> with wrong parameters.*/
function json_last_error_msg () {}


/**
*      所有的 &lt; 和 &gt; 转换成 \u003C 和 \u003E。      自 PHP 5.3.0 起生效。     
*/
define ('JSON_HEX_TAG', 1);

/**
*      所有的 &amp; 转换成 \u0026。      自 PHP 5.3.0 起生效。     
*/
define ('JSON_HEX_AMP', 2);

/**
*      所有的 &#039; 转换成 \u0027。      自 PHP 5.3.0 起生效。     
*/
define ('JSON_HEX_APOS', 4);

/**
*      所有的 &quot; 转换成 \u0022。     自 PHP 5.3.0 起生效。     
*/
define ('JSON_HEX_QUOT', 8);

/**
*      使一个非关联数组输出一个类（Object）而非数组。      在数组为空而接受者需要一个类（Object）的时候尤其有用。      自 PHP 5.3.0 起生效。     
*/
define ('JSON_FORCE_OBJECT', 16);

/**
*      将所有数字字符串编码成数字（numbers）。      自 PHP 5.3.3 起生效。     
*/
define ('JSON_NUMERIC_CHECK', 32);

/**
*      不要编码 <em>/</em>。      自 PHP 5.4.0 起生效。     
*/
define ('JSON_UNESCAPED_SLASHES', 64);

/**
*      用空白字符格式化返回的数据。      自 PHP 5.4.0 起生效。     
*/
define ('JSON_PRETTY_PRINT', 128);

/**
*      以字面编码多字节 Unicode 字符（默认是编码成 \uXXXX）。      自 PHP 5.4.0 起生效。     
*/
define ('JSON_UNESCAPED_UNICODE', 256);
/**
*      Substitute some unencodable values instead of failing.      Available since PHP 5.5.0.     
*/
define ('JSON_PARTIAL_OUTPUT_ON_ERROR', 512);

/**
*      出现了下溢（underflow）或者模式不匹配。自 PHP 5.3.0 起生效。     
*/
define ('JSON_ERROR_STATE_MISMATCH', 2);

/**
*      控制字符错误，可能是编码不对。自 PHP 5.3.0 起生效。     
*/
define ('JSON_ERROR_CTRL_CHAR', 3);

/**
*      异常的 UTF-8 字符，也许是因为不正确的编码。     自 PHP 5.3.3 起生效。     
*/
define ('JSON_ERROR_UTF8', 5);

/**
*      The object or array passed to <span class="function">{@link json_encode()}</span> include      recursive references and cannot be encoded.      If the <strong><code>JSON_PARTIAL_OUTPUT_ON_ERROR</code></strong> option was      given, <strong><code>NULL</code></strong> will be encoded in the place of the recursive reference.      Available since PHP 5.5.0.     
*/
define ('JSON_ERROR_RECURSION', 6);

/**
*      The value passed to <span class="function">{@link json_encode()}</span> includes either      <a href="http://php.net/manual/zh/language.types.float.php#language.types.float.nan" class="link"><strong><code>NAN</code></strong></a>      or {@link <strong><code>INF</code></strong>}.      If the <strong><code>JSON_PARTIAL_OUTPUT_ON_ERROR</code></strong> option was      given, <em>0</em> will be encoded in the place of these      special numbers.      Available since PHP 5.5.0.     
*/
define ('JSON_ERROR_INF_OR_NAN', 7);

/**
*      A value of an unsupported type was given to      <span class="function">{@link json_encode()}</span>, such as a <span class="type"><a href="http://php.net/manual/zh/language.types.resource.php" class="type resource">resource</a></span>.      If the <strong><code>JSON_PARTIAL_OUTPUT_ON_ERROR</code></strong> option was      given, <strong><code>NULL</code></strong> will be encoded in the place of the unsupported value.      Available since PHP 5.5.0.     
*/
define ('JSON_ERROR_UNSUPPORTED_TYPE', 8);

/**
*      没有错误发生。自 PHP 5.3.0 起生效。     
*/
define ('JSON_ERROR_NONE', 0);

/**
*      到达了最大堆栈深度。自 PHP 5.3.0 起生效。     
*/
define ('JSON_ERROR_DEPTH', 1);

/**
*      语法错误。      自 PHP 5.3.0 起生效。     
*/
define ('JSON_ERROR_SYNTAX', 4);
/**
*      Decodes JSON objects as PHP array. This option can be added automatically      by calling <span class="function">{@link json_decode()}</span> with the second parameter      equal to <strong><code>TRUE</code></strong>.      Available since PHP 5.4.0.     
*/
define ('JSON_OBJECT_AS_ARRAY', 1);
define ('JSON_PARSER_NOTSTRICT', 4);

/**
*      将大数字编码成原始字符原来的值。      自 PHP 5.4.0 起生效。     
*/
define ('JSON_BIGINT_AS_STRING', 2);

/**
*      Ensures that <span class="type"><a href="http://php.net/manual/zh/language.types.float.php" class="type float">float</a></span> values are always encoded as a float      value.      Available since PHP 5.6.6.     
*/
define ('JSON_PRESERVE_ZERO_FRACTION', 1024);

/**
*      The line terminators are kept unescaped when      <strong><code>JSON_UNESCAPED_UNICODE</code></strong> is supplied. It uses the same      behaviour as it was before PHP 7.1 without this constant.      Available since PHP 7.1.0.     
*/
define('JSON_UNESCAPED_LINE_TERMINATORS', 2048);

/**
 * @since 7.2
 */
define('JSON_INVALID_UTF8_IGNORE', 1048576);

/**
 * @since 7.2
 */
define('JSON_INVALID_UTF8_SUBSTITUTE', 2097152);

/**
*      A key starting with \u0000 character was in the string passed to      <span class="function">{@link json_decode()}</span> when decoding a JSON object into a PHP      object.      Available since PHP 7.0.0.     
*/
define('JSON_ERROR_INVALID_PROPERTY_NAME',9);

/**
*      Single unpaired UTF-16 surrogate in unicode escape contained in the      JSON string passed to <span class="function">{@link json_encode()}</span>.      Available since PHP 7.0.0.     
*/
define('JSON_ERROR_UTF16',10);

/**
 * @since 7.2
 **/
define('JSON_INVALID_UTF8_IGNORE',1048576);

/**
 * @since 7.2
 */
define('JSON_INVALID_UTF8_SUBSTITUTE',2097152);



// End of json v.1.3.1
?>
